//1619.删除某些元素后的数组均值
//https://leetcode.cn/problems/mean-of-array-after-removing-some-elements/
class Solution {
public:
    double trimMean(vector<int>& arr) {
        sort(arr.begin(),arr.end());
        int n = arr.size();
        int sum = 0;
        //注意sum+=arr[i],++i的顺序不能乱 否则先执行++i后就漏掉了数字且会越界
        for(int i = n*0.05;i<(n-n/20);sum+=arr[i],++i);
        return sum/(n*0.9);
    }
};
